package 生产者消费者模型;

import java.util.concurrent.locks.LockSupport;

//加上final并且没有setter方法表示该Message不能被修改并且不能被子类继承,覆盖重写
//生产者只需往队列中存放消息,消费者只需从队列中取走消息,两者不需关心Message的具体实现
public final class Message {
    private int id;
    private Object value;

    public Message(int id, Object value) {
        this.id = id;
        this.value = value;
    }

    public int getId() {
        return id;
    }

    public Object getValue() {
        return value;
    }

    @Override
    public String toString() {
        return "Message{" +
                "id=" + id +
                ", value=" + value +
                '}';
    }
}